package com.example.dllo.exe.fenlei.gonglue;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.example.dllo.exe.R;
import com.example.dllo.exe.bean.GongLueBean;
import com.example.dllo.exe.fengzhuang.NetTool;
import com.example.dllo.exe.remen.ReMenRvAdapter;

/**
 * code is far away from bug with the animal protecting
 * <p>
 * ┏┓　　　┏┓
 * ┏┛┻━━━┛┻┓
 * ┃　　　　　　　┃
 * ┃　　　━　　　┃
 * ┃　┳┛　┗┳　┃
 * ┃　　　　　　　┃
 * ┃　　　┻　　　┃
 * ┃　　　　　　　┃
 * ┗━┓　　　┏━┛
 * 　　┃　　　┃神兽保佑
 * 　　┃　　　┃永无BUG！  凯哥 祝你一路顺风
 * 　　┃　　　┗━━━┓
 * 　　┃　　　　　　　┣┓
 * 　　┃　　　　　　　┏┛
 * 　　┗┓┓┏━┳┓┏┛
 * 　　　┃┫┫　┃┫┫
 * 　　　┗┻┛　┗┻┛
 */
public class GongLuePinLeiChaKanQuanBuAdapter extends RecyclerView.Adapter<GongLuePinLeiChaKanQuanBuAdapter.MyViewHolder>{
    private Context context;
    private GongLueBean gongLueBean;
   private int i;

    public void setI(int i) {
        this.i = i;
    }

    public void setGongLueBean(GongLueBean gongLueBean) {
        this.gongLueBean = gongLueBean;
        notifyDataSetChanged();
    }

    public GongLuePinLeiChaKanQuanBuAdapter(Context context) {
        this.context = context;
    }

    @Override
    public GongLuePinLeiChaKanQuanBuAdapter.MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view= LayoutInflater.from(context).inflate(R.layout.gongluepinleichakanquanbufragmentlayout,parent,false);
        MyViewHolder viewHolder=new MyViewHolder(view);
        return viewHolder;
    }

    @Override
    public void onBindViewHolder(GongLuePinLeiChaKanQuanBuAdapter.MyViewHolder holder, int position) {
        NetTool netTool = new NetTool();
   switch (i){
       case 0:
       netTool.getImage(gongLueBean.getData().getChannel_groups().get(0).getChannels().get(position).getCover_image_url(), holder.image_coverurlgonglue);
           break;
     }

    }

    @Override
    public int getItemCount() {
        return gongLueBean != null ? 15 : 0;
    }

    public class MyViewHolder extends RecyclerView.ViewHolder {
        ImageView image_coverurlgonglue;
        public MyViewHolder(View itemView) {
            super(itemView);
            image_coverurlgonglue = (ImageView) itemView.findViewById(R.id.image_covergongluerv);
        }
    }
}
